import {reqGetSearchInfo} from '@/api'
//仓库存储数据的
const state = {
    searchList:{},
};
//修改state的唯一手段
const mutations = {
    GETSEARCHLIST(state,searchList){
        state.searchList = searchList
    }
};
//处理action，书写业务逻辑，异步处理
const actions = {
    async getSearchList({commit},params = {}){
        let result = await reqGetSearchInfo(params)
        if(result.code ==200){
            commit("GETSEARCHLIST",result.data)
        }
    }
};

//getters理解为计算属性让组件获取仓库数据更方便
const getters = {
    goodsList(state){
        return state.searchList.goodsList
    },
    trademarkList(state){
        return state.searchList.trademarkList
    },
    attrsList(state){
        return state.searchList.attrsList
    }
};

//暴露一个store实例
export default {
    state,
    mutations,
    actions,
    getters
}
 
